<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/inc/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>支付管理</title>
	
	<link type="text/css" rel="stylesheet" href="${path }/js/easyui/themes/default/easyui.css">
	<link type="text/css" rel="stylesheet" href="${path }/css/button/button.css">
	<link type="text/css" rel="stylesheet" href="${path }/css/button/icon.css">
	<script type="text/javascript" src="${path }/js/jquery-1.4.2.min.js"></script>
	<script type="text/javascript" src="${path }/js/easyui/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="${path }/js/easyui/locale/easyui-lang-zh_CN.js"></script>
	<script type="text/javascript">
		var path = "${path}";
	</script>
	
	<script language="javascript" src="${path }/js/button/button.js"></script>
	<script type="text/javascript" src="${path }/js/dialog/zDialog.js"></script>
	<script type="text/javascript" src="${path }/js/dialog/zDrag.js"></script>
	<script type="text/javascript" src="${path }/js/app/adminpayment.js"></script>
	<script type="text/javascript" src="${path }/js/app/managerpayment.js"></script>
	<script type="text/javascript">	
		
		var grid;
		var mgrid;
		$(function(){
			grid = $('#list-table').datagrid({
				
				url:path + '/admin/payment/list',
				title:'商城支付列表',
				width:700,
				height:250,
				singleSelect:true,
				pagination:true,
				columns:fields
			});
			
			mgrid= $("#mlist-table").datagrid({
				url:path + '/manager/payment/list',
				title:'您的支付列表',
				width:700,
				height:250,
				singleSelect:true,
				pagination:true,
				columns:ifields
			});
			
		});
		
		function add(){
			var row = grid.datagrid('getSelected');
			if (row){
				var payId = row.payId;
				var url = "/manager/payment/add/"+payId;
				
				var diag = new Dialog();
				diag.Width = 350;
				diag.Height = 200;
				diag.Title = "添加支付方式";
				diag.URL = url;
				diag.show();
			} else {
				$.messager.alert('警告','请先选择商城支付方式!','error');
			}
		}
		
		function del(){
			var row = mgrid.datagrid('getSelected');
			if (row){
				var id = row.id;
				var url = "/manager/payment/del/"+id;
				
				$.post(
					url,
					function(json){
						if(json.result == "Success"){
							alert("删除成功!");
							refresh();
						}
							
					},
					'json'
				);
			} else {
				$.messager.alert('警告','请先选择支付方式!','error');
			}
		}
		
		
		function refresh(){
			grid.datagrid('reload');
			mgrid.datagrid('reload');
		}
		
	</script>
	
	
</head>
<body>
	
	
	
	<table id="list-table">
		
	</table>
	<table id="fun">
		<tr>
			<td>
				<input type="button" value="添加↓" onclick="add()">
			</td>
			<td>
				<input type="button" value="删除↑" onclick="del()">
			</td>
		</tr>
	</table>
	
	<table id="mlist-table">
	
	</table>
	
</body>
</html>